const express = require("express");
const router = express.Router();
const menuService = require("./service/MenuServiceImpl");

// 新增修改菜单
router.post("/saveOrUpdate", (req, res, next) => {
  menuService.saveOrUpdate(req, res, next);
});

// 获取菜单列表
router.post("/getMenuTree", (req, res, next) => {
  menuService.getMenuTree(req, res, next);
});

// 删除菜单 需先删除下级菜单
router.post("/deleteWithoutSub", (req, res, next) => {
  menuService.deleteWithoutSub(req, res, next);
});

// 删除菜单 会删除所有下级菜单
router.post("/deleteAllSub", (req, res, next) => {
  menuService.deleteAllSub(req, res, next);
});

// 新增/修改按钮权限
router.post("/saveOrUpdatePerms", (req, res, next) => {
  menuService.saveOrUpdatePerms(req, res, next);
});
// 删除按钮
router.post("/deletePerms", (req, res, next) => {
  menuService.deletePerms(req, res, next);
});

module.exports = router;
